package com.wb.service.impl;

import com.wb.mapper.EbProductCategoryMapper;
import com.wb.model.EbProductCategory;
import com.wb.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ProductCategoryServiceImpl implements ProductCategoryService {

    @Autowired
    private EbProductCategoryMapper ebProductCategoryMapper;

    @Override
    public Map<String, List<EbProductCategory>> findBigAndSmallCategory() {
        //1.查询所有大类
        List<EbProductCategory> bigs = ebProductCategoryMapper.selectBigCategory();
        //System.out.println("所有大类："+bigs);
        //2.查询所有小类
        List<EbProductCategory> smalls = ebProductCategoryMapper.selectSmallCategory();
        //System.out.println("所有小类："+smalls);
        //3.封装到map集合
        Map<String,List<EbProductCategory>> categoryMap= new HashMap<>();
        categoryMap.put("bigs",bigs);
        categoryMap.put("smalls",smalls);

        return categoryMap;
    }
}
